int myWidth,myHeight,rectWidth,rectHeight;
Car car1,car2,car3;
boolean isCar1,isCar2,isCar3;


void setup(){
  colorMode(HSB);
  //myWidth=displayWidth/2;
  //myHeight=displayHeight-120;
  rectWidth=200;
  rectHeight=160;
  myWidth=displayWidth;
  myHeight=displayHeight;
  //size(myWidth,myHeight);
  size(displayWidth,displayHeight);
  car1=new Car(0,0,rectWidth,rectHeight,color(#FF6600));
  
  car2=new Car(   myWidth/2-rectWidth/2,
                  myHeight/2-rectHeight/2,
                  rectWidth,
                  rectHeight,
                  color(#800099));
  car3=new Car(   myWidth-rectWidth,
                  myHeight-(5*rectHeight/6),
                  rectWidth,
                  rectHeight,
                  color(#663300));
}

void draw(){
  background(255);
  car1.draw();
  car2.draw();
  car3.draw();
  //resultado = rec1.revisarPosicion(mouseX,mouseY);
}

/*void mouseClicked(){
isCar1 = car1.revisarPosicion(mouseX,mouseY);
isCar2 = car2.revisarPosicion(mouseX,mouseY);
isCar3 = car3.revisarPosicion(mouseX,mouseY);
}*/

void mouseDragged(){
  
isCar1 = car1.isMouseIn(mouseX,mouseY);
isCar2 = car2.isMouseIn(mouseX,mouseY);
isCar3 = car3.isMouseIn(mouseX,mouseY);  

if(isCar1)
car1.moveCarHor(mouseX);
if(isCar2)
car2.moveCarHor(mouseX);
if(isCar3)
car3.moveCarHor(mouseX);

}
